import axios from 'axios';

var baseApiUrl = "http://localhost:8081/teach_api/";

var protocol=window.location.protocol

baseApiUrl = protocol+ '//' + window.location.host + "/teach_api/";


export default {

    getUserInfo() {
        return "";
    },

	/**
	 * 获取首页列表页数据
	 * @returns {Promise.<*>}
	 */
    async GetPublishList() {
        var url = baseApiUrl + "CourseInfo/GetPublishList";
        return await axios.get(url).then((res) => res.data.Data);
    },

    /**
	 * 获取首页列表页数据
	 * @returns {Promise.<*>}
	 */
    async GetGradeListById(directoryId) {
        var url = baseApiUrl + `CourseInfo/GetGradeListById?directoryId=${directoryId}`;
        return await axios.get(url).then((res) => res.data.Data);
    },

    /**
     * 获取首页列表页数据
     * @returns {Promise.<*>}
     */
    async GetClassListById(directoryId) {
        var url = baseApiUrl + `CourseInfo/GetClassListById?directoryId=${directoryId}`;
        return await axios.get(url).then((res) => res.data.Data);
    },

    /**
	 * 获取左侧字列表
	 * @returns {Promise.<*>}
	 */
    async GetWordListById(directoryId) {
        var url = baseApiUrl + `CourseInfo/GetWordListById?directoryId=${directoryId}`;
        return await axios.get(url).then((res) => res.data.Data);
    },

    /**
	 * 获取左侧字单字
	 * @returns {Promise.<*>}
	 */
    async GetSingleWordListById(directoryId) {
        var url = baseApiUrl + `CourseInfo/GetSingleWordListById?directoryId=${directoryId}`;
        return await axios.get(url).then((res) => res.data.Data);
    },

    /**
	 * 获取左侧字详细模板
	 * @returns {Promise.<*>}
	 */
    async GetTemplateListById(directoryId) {
        var url = baseApiUrl + `CourseInfo/GetTemplateListById?directoryId=${directoryId}`;
        return await axios.get(url).then((res) => res.data.Data);
    },


    /**
 * 通用树状
 * @returns {Promise.<*>}
 */
    async GetCurrentDirectoryEntity(directoryId) {
        var url = baseApiUrl + `CourseInfo/GetCurrentDirectoryEntity?directoryId=${directoryId}`;
        return await axios.get(url).then((res) => res.data.Data);
    },


    GetShuTiList() {
        var url = baseApiUrl + `JZPractice/GetShuTiList`;
        return axios.get(url).then((res) => res.data.Data);
    },

    GetShuJiaList(directoryId) {
        var url = baseApiUrl + `JZPractice/GetShuJiaList`;
        return axios.get(url).then((res) => res.data.Data);
    },

    GetJZPracticeList(param) {

        return axios({
            url: baseApiUrl + "JZPractice/GetJZPracticeList",
            method: "post",
            data: param
        }).then((res) => res.data.Data);
    },


    //6.1	获取书法知识列表
    GetWritingKnowledgeList(param) {

        return axios({
            url: baseApiUrl + "WritingSpace/GetWritingKnowledgeList",
            method: "get",
            data: param
        }).then((res) => res.data.Data);
    },

    //6.2	获取书家典故列表
    GetWritingStoryList(param) {

        return axios({
            url: baseApiUrl + "WritingSpace/GetWritingStoryList",
            method: "get",
            data: param
        }).then((res) => res.data.Data);
    },

    //4.1	获取朝代列表接口
    GetChaoDaiList() {
        return axios({
            url: baseApiUrl + "Beitie/GetChaoDaiList",
            method: "get"
        }).then((res) => res.data.Data);
    },

    //4.5	根据作品名称或书家获取碑帖列表接口
    SearchBeitieList(param) {

        return axios({
            url: baseApiUrl + "Beitie/SearchBeitieList",
            method: "post",
            data: param
        }).then((res) => res.data.Data);
    },

    GetBeitieListById(id) {
        return axios({
            url: baseApiUrl + "Beitie/GetBeitieListById?keyword=" + id,
            method: "get"
        }).then((res) => res.data.Data);
    }
    ,
    GetBeitieCoordsListById(id) {
        return axios({
            url: baseApiUrl + "Beitie/GetBeitieCoordsListById?keyword=" + id,
            method: "get"
        }).then((res) => res.data.Data);
    },

    SaveLinmoWord(param) {
        return axios({
            url: baseApiUrl + "JZPractice/SaveLinmoWord",
            method: "post",
            data: param
        }).then((res) => res.data.Data);
    },

    GetLinmoWordList(param) {
        return axios({
            url: baseApiUrl + "JZPractice/GetLinmoWordList",
            method: "post",
            data: param
        }).then((res) => res.data.Data);
    },

    GetFuShiChildListById(directoryId) {
        directoryId=directoryId||"11111111-1111-1111-1111-111111111111";
        return axios({
            url: baseApiUrl + "JZPractice/GetFuShiChildListById?directoryId="+directoryId,
            method: "get"
        }).then((res) => res.data.Data);
    },

    GetFuShiList() {
        return axios({
            url: baseApiUrl + "JZPractice/GetFuShiList",
            method: "get"
        }).then((res) => res.data.Data);
    },


    DeleteLinmoWord(keyValue) {
        return axios({
            url: baseApiUrl + "/JZPractice/DeleteLinmoWord?keyValue="+keyValue,
            method: "get"
        }).then((res) => res.data.Data);
    },

    GetWordLinmoEntityById(directoryId) {
        return axios({
            url: baseApiUrl + "/JZPractice/GetWordLinmoEntityById?directoryId="+directoryId,
            method: "get"
        }).then((res) => res.data.Data);
    },
    GetFuShiEntityById(directoryId) {
        return axios({
            url: baseApiUrl + "/JZPractice/GetFuShiEntityById?directoryId="+directoryId,
            method: "get"
        }).then((res) => res.data.Data);
    },


    GetFameworksList(param) {
        return axios({
            url: baseApiUrl + "FameworksApi/GetFameworksList",
            method: "post",
            data: param
        }).then((res) => res.data.Data);
    },

    

}
